/* eslint-disable */

// 校验手机号
export const isPhone = (tel) => {
    const regexp = /^[1][3,4,5,7,8][0-9]{9}$/
    return regexp.test(tel) === true
}

// 校验纯数字
export const isNum = (num) => {
    const regexp = /^[0-9]*$/
    return regexp.test(num) === true
}

// 去两端空格
export const replaceTrim = (num) => {
    return num.trim()
}

// 校验座机
export const Landline = (num) => {
    const regexp = /^((0\d{2,3})-)(\d{7,8})(-(\d{3,}))?$/
    return regexp.test(replaceTrim(num)) === true
}

// 校验合法的身份证号
export const CheckCardNo = (num) => {
  const regexp = /^(([1][1-5])|([2][1-3])|([3][1-7])|([4][1-6])|([5][0-4])|([6][1-5])|([7][1])|([8][1-2]))\d{4}(([1][9]\d{2})|([2]\d{3}))(([0][1-9])|([1][0-2]))(([0][1-9])|([1-2][0-9])|([3][0-1]))\d{3}[0-9xX]$/
  return regexp.test(replaceTrim(num)) === true
}

// 校验银行卡号
export const isCardNum = (num) => {
  const regexp = /([\d]{4})([\d]{4})([\d]{4})([\d]{4})([\d]{0,})?/
  return regexp.test(replaceTrim(num)) === true
}